<template>
  <div class="orderData">
    <div class="title">
      <div class="leftTitle">
        {{ formData.saleCardName }}
        <span>{{ formData.saleCardStatus | cardStatus }}</span>
      </div>
      <div class="rightTitle">{{ formData.shopName }}</div>
    </div>
    <div class="detailsData">
      <div class="left">
        <div class="browse">
          <div class="num">{{ formData.browsCount || 0 }}</div>
          <div class="name">浏览量</div>
        </div>
        <div class="forward">
          <div class="num">{{ formData.forwardCount || 0 }}</div>
          <div class="name">转发量</div>
        </div>
        <div class="order">
          <div class="num">{{ formData.orderCount || 0 }}</div>
          <div class="name">订单量</div>
        </div>
      </div>
      <div class="right">
        <div class="cancellated">
          <div class="num">{{ formData.confirmCount || 0 }}</div>
          <div class="name">已核销</div>
        </div>
        <div class="noCancellated">
          <div class="num">{{ formData.notConfirmCount || 0 }}</div>
          <div class="name">未核销</div>
        </div>
        <!-- <div class="waitCheck">
          <div class="num">{{formData.forwardCount}}</div>
          <div class="name">待审核</div>
        </div> -->
        <div class="cancel">
          <div class="num">{{ formData.cancelCount || 0 }}</div>
          <div class="name">已取消</div>
        </div>
        <div class="refunded">
          <div class="num">{{ formData.refundCount || 0 }}</div>
          <div class="name">已退款</div>
        </div>
        <div class="waitRefund">
          <div class="num">{{ formData.unpaidCount || 0 }}</div>
          <div class="name">待付款</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "orderData",
  props: {
    card: {
      type: String,
      default: "",
    },
  },
  created() {
    this.getOrderData();
  },
  filters: {
    cardStatus(item) {
      switch (item) {
        case 1:
          return "(未发布)";
        case 2:
          return "(进行中)";
        case 3:
          return "(已暂停)";
        case 4:
          return "(已结束)";
        default:
          return "";
      }
    },
  },
  data() {
    return {
      formData: {},
    };
  },
  methods: {
    async getOrderData() {
      let res = await this.$get("/sale/card/statistics", {
        id: this.card,
      });
      if (res && res.returnCode == 1000) {
        this.formData = res.dataInfo;
      }
    },
  },
};
</script>
<style lang="less" scoped>
.orderData {
  padding: 30px;
  border-radius: 8px;
  background: #f5f5f5;
  width: 100%;
}
.title {
  display: flex;
  justify-content: space-between;
  .leftTitle {
    font-size: 30px;
    font-weight: bolder;
    span {
      font-size: 20px;
      font-weight: normal;
    }
  }
  .rightTitle {
    font-size: 28px;
  }
}
.detailsData {
  display: flex;
  margin-top: 20px;
  justify-content: space-between;
  .left {
    display: flex;
    width: 40%;
    .browse,
    .forward,
    .order {
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-right: 40px;
      .num {
        text-align: center;
        font-size: 30px;
        color: #00a5ff;
        font-weight: bolder;
      }
      .name {
        text-align: center;
        font-size: 16px;
      }
    }
  }
  .right {
    display: flex;
    .cancellated,
    .noCancellated,
    .waitCheck,
    .cancel,
    .refunded,
    .waitRefund {
      flex-direction: column;
      align-items: center;
      margin-right: 50px;
      .num {
        text-align: center;
        font-size: 30px;
        color: #00a5ff;
        font-weight: bolder;
      }
      .name {
        text-align: center;
        font-size: 16px;
      }
    }
  }
}
</style>